from django.db import models
from django.contrib.auth.models import User
from django.contrib import admin


class ChatRoom(models.Model):
    name = models.TextField()
    birth_day = models.DateTimeField(auto_now_add=True)
    last_modify = models.DateTimeField(auto_now=True)
    author = models.ForeignKey(User)
    
    def __unicode__(self):
        return self.name

admin.site.register(ChatRoom)    

class Message(models.Model):
    sender = models.ForeignKey(User)
    message = models.TextField()
    send_time = models.DateTimeField(auto_now=True)

    def __unicode__(self):
        return self.message

admin.site.register(Message)
